﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mappings;

namespace Apollo.Modules.Sales
{
    [NHibernateEntity(Table = "Opportunities")]
    public class Opportunity : ITrackable
    {
        public Opportunity() { }

        [PrimaryKey]
        public virtual int Id { get; set; }

        [BelongsTo(Column = "ID_Account", NotNull = true)]
        public virtual Account Account { get; set; }

        [BelongsTo(Column = "ID_Campaign")]
        public virtual Campaign Campaign { get; set; }

        [Property]
        public virtual OpportunityState State { get; set; }

        [BelongsTo(Column = "ID_Last_Activity")]
        public virtual Activity LastActivity { get; set; }

        [BelongsTo(Column = "ID_Lead")]
        public virtual Lead Lead { get; set; }




        [Property]
        public virtual string Comment { get; set; }

        [BelongsTo(Column = "ID_OpportunityStep")]
        public virtual OpportunityStep Step { get; set; }

        [BelongsTo(Column = "ID_OpportunityClosingReason")]
        public virtual OpportunityClosingReason ClosingReason { get; set; }

        [Property]
        public virtual string AdditionalInfo { get; set; }

        [Property]
        public virtual DateTime StartDate { get; set; }

        [Property]
        public virtual DateTime? EndDate { get; set; }


        [Property]
        public virtual DateTime InsertDate { get; set; }

        [Property]
        public virtual string InsertBy { get; set; }

        [Property]
        public virtual DateTime? ModifiedDate { get; set; }

        [Property]
        public virtual string ModifiedBy { get; set; }

    }

    public enum OpportunityState { 
        InProgress = 0,
        Won = 1,
        Failed = 2,
        Closed = 3 // if here the user never replied; similar to Failed
    }
}
